package grouup3_project4;

// Alex Hurtt

import javax.swing.*;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class PersonGui implements ActionListener
{
	public static void main(String[] args)
	{
		final JFrame frame = new JFrame("Constructor");
		frame.setLayout(new GridLayout(5,1));
		frame.setVisible(true);
		
		ButtonGroup group = new ButtonGroup();
		final JRadioButton person = new JRadioButton("Create new person", false);
		final JRadioButton student = new JRadioButton("Create new student", false);
		final JRadioButton employee = new JRadioButton("Create new employee", false);
		
		group.add(person);
		group.add(student);
		group.add(employee);
		
		frame.add(person);
		frame.add(student);
		frame.add(employee);
		
		frame.pack();
		
		JButton create = new JButton("Create");
		create.addActionListener(new ActionListener() 
		{		
			@Override
			public void actionPerformed(ActionEvent e) 
			{
				if (person.isSelected())
				{
					Person p = new Person();
					p.createPerson();
				}
				if (student.isSelected())
				{
					Student s = new Student();
					s.createStudent();
				}
				if (employee.isSelected())
				{
					Employee empl = new Employee();
					empl.createEmployee();
				}
			}
		});
		frame.add(create);	
		
		JButton close = new JButton("Close");
		close.addActionListener(new ActionListener() 
		{	
			@Override
			public void actionPerformed(ActionEvent e) 
			{
				System.exit(0); 			
			}
		});
		frame.add(close);
	}
	
	

	@Override
	public void actionPerformed(ActionEvent e) 
	{	

	}
}
